$(document).ready(function(){
   var search_brand_data = '';
   $('#js_searchBrand').parent().hover(function(){
  var a=setTimeout(function(){
		if (search_brand_data==''){
		$.ajax({
		  url:'http://localhost:8081/healthfood/layout/headerallcat.xhtml',
		  type: 'GET',
		  dataType: 'html',
		  cache:true,
		  timeout: 30000,
		  error: function(){
			$('#js_searchBrandList div.loading').text('载入失败');
			$('#js_searchBrandList').remove();
			$('#js_searchBrand').removeClass('open');
		  },
		  success: function(data){
			  search_brand_data = data;
			  $('#js_searchBrand').addClass('open');
				$('#js_searchBrand').parent().append('<div id="js_searchBrandList"><h2>全部品牌分类1</h2><ul></ul></div>');
				
				$('#js_searchBrandList ul').html(data);
				$('#js_searchBrandList li').hover(function(){
				  $('#js_searchBrandList li').removeClass('selected');
				  $(this).addClass('selected');
				}, function(){
				  $(this).removeClass('selected');
				});
		    }
		  });
		}else{
			$('#js_searchBrand').addClass('open');
		    $('#js_searchBrand').parent().append('<div id="js_searchBrandList"><h2>全部品牌分类2</h2><ul></ul></div>');
			
			$('#js_searchBrandList ul').html(search_brand_data);
			$('#js_searchBrandList li').hover(function(){
			  $('#js_searchBrandList li').removeClass('selected');
			  $(this).addClass('selected');
			}, function(){
			  $(this).removeClass('selected');
			});
		}
		 },500);
		 $('#js_searchBrand').parent().mouseout(function(){clearTimeout(a);});
  },function(){
	$('#js_searchBrandList').remove();
	  $('#js_searchBrand').removeClass('open');
  });
   
   
   
   $('#yohobuy_head_sort h2 span').hover(function() {
	   
	   $('#yohobuy_head_sort_list').css('display','block');
		   
   }
   );
 
   $('CateListView li').hover(function() {
	   alert('fdf');
	   $(this).children('div').css('display','block');
   });
   $('CateListView li').mouseout(function() {
	   $(this).children('div').css('display','none');
   });

});

function ECS_TREE_VIEW()
{
	 var list=document.getElementById('CateListView').getElementsByTagName('li');
	 var tempCur="";
	 for(i=0;i<list.length;i++)
	 {
		 list[i].onmouseover=function()
		 {
			 tempCur=this.getElementsByTagName("a")[0].className;
			  this.getElementsByTagName("a")[0].className=tempCur=="cur"?'cur':'cur1';
			 if(this.getElementsByTagName('div')[0])
			 {
			   this.getElementsByTagName('div')[0].style.display='block';
			   this.getElementsByTagName('iframe')[0].style.display='block';
			 } 
		 }
		 list[i].onmouseout=function()
		 {
			 this.getElementsByTagName("a")[0].className=tempCur;
			if(this.getElementsByTagName('div')[0])
			{
			   this.getElementsByTagName('div')[0].style.display='none';
			   this.getElementsByTagName('iframe')[0].style.display='none';
			}
		 }
	 }
 }











